<?php
require_once '../inc/configuration.php';
require_once '../inc/connexion_bd.php';

$order = isset($_GET['ordre']) ? "ORDER BY raison_sociale ".$_GET['ordre'] : "";

$sql = "SELECT * FROM entreprises ".$order;
    
$req = mysqli_query($connexion_serveur, $sql); 
        
$nbre_total = mysqli_num_rows($req);
?>


<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
        
        <?php require_once "../inc/css_js_bootstrap/css_js_bootstrap.php"; ?>
    </head>
    <body>
        <?php require_once '../inc/menus/menu_principal.php'; ?>
        <form>
            <h2>LISTE DES ENTREPRISES</h2>
            <?php echo "<h3>Nombre d'entreprises affichées:  ".$nbre_total."</h3>"; ?>  
        <?php
       while($resultats = mysqli_fetch_assoc($req)) {?>
        
            
            
            <table>
                <tr>
                    <td>n°</td>
                    <td><?php echo $resultats["id"]; ?></td>
                </tr>
                 <tr>
                    <td>Raison sociale</td>
                    <td><a href="../contacts/liste_contacts.php?id=<?php echo $resultats["id"]; ?>"><?php echo $resultats["raison_sociale"]; ?></a></td>
                    <!--<td><?php //echo $resultats["raison_sociale"]; ?></td>-->
                </tr>
                <tr>
                    <td>Adresse</td>
                    <td><?php echo $resultats["adresse"]; ?></td>
                </tr>
               <tr>
                    <td>Téléphone</td>
                    <td><?php echo $resultats["telephone"]; ?></td>
                </tr>
                <tr>
                    <td>Fax</td>
                    <td><?php echo $resultats["fax"]; ?></td>
                </tr>
                      <tr>
                    <td>Email</td>
                    <td><?php echo $resultats["email"]; ?></td>
                </tr>
                <tr>
                    <td>Observations</td>
                    <td><?php echo $resultats["observations"]; ?></td>
                </tr><br><br>
            </table>
            
            
      <?php 
      
      } ?>
        
        
    </body>
</html>
